package com.forenow.oop;

/**
 * 构造器（构造方法）
 */
public class ConstrctorDemo {
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public ConstrctorDemo(String name , int age){
        this.name= name;
        this.age=age;
        //System.out.println("这是一个构造器.......");
    }
    public static void main(String[] args) {
        ConstrctorDemo constrctorDemo= new ConstrctorDemo("fender",23);
        System.out.println(constrctorDemo.getAge()+"---"+constrctorDemo.getName());
    }
}
